-- multi_surplus_use
-- created by wangy
-- 道具描述：道具固定使用次数，剩余使用次数

return {
    -- 获取道具描述
    getDesc = function(itemId, args, para)
        assert(type(args) == "string", "detail_args期望是string类型。");

        local dbase = PropertyM.query(itemId, "dbase");
        local maxUseTimes = dbase["max_times"] or 0;
        local propertyUsed = ME.user.dbase:query("property_used", {});
        local usedTimes = propertyUsed[itemId] or 0;

        return string.format(args, maxUseTimes - usedTimes);
    end,

    -- 获取道具细节描述
    getDetail = function(itemId, args, para)
        assert(type(args) == "string", "detail_args期望是string类型。");

        local dbase = PropertyM.query(itemId, "dbase");
        local maxUseTimes = dbase["max_times"] or 0;
        local propertyUsed = ME.user.dbase:query("property_used", {});
        local usedTimes = propertyUsed[itemId] or 0;

        return string.format(args, maxUseTimes - usedTimes);
    end,
};
